{extend name="common/base"/}
{block name="style"}
<style type="text/css">
	.dashboard-num table {width: 100%;}
	.dashboard-num td {text-align: center; padding: 16px 0; width: 20%;border-left: 1px solid #f1f1f1; position: relative;}
	.dashboard-num td:nth-child(1) { border-left: none}
	.dashboard-num .num-title { padding-bottom: 10px; color: #999;}
	.dashboard-num .blue {font-size: 20px; font-weight: 300;}
	.dashboard-num td .badge {position: absolute;top: 0; right: 0;}
	.dashboard-num td .badge span { padding: 2px 4px; font-size: 12px; border-radius: 0 0 0 4px;}
	.dashboard-total td {border-top: 1px solid #f1f1f1}
	.dashboard-logs .layui-timeline-item {padding-bottom: 1px;}
	.info-td { width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;}
	.info-td {width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;}
	.layui-card-body .layui-timeline-title {
		padding-bottom: 0;
		font-size: 14px;
	}
	.layui-card-body .layui-timeline-item {
		padding-bottom: 5px;
	}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
	<div class="layui-row layui-col-space12">
		<div class="layui-col-md8">
			<div class="layui-row layui-col-space12">
				<div class="layui-col-md12">
					<div class="layui-card dashboard-num">
						<table>
							<tr>
								<td>
									<div class="num-title">线索数量</div>
									<div class="blue">{$conf.xiansuo}</div>
								</td>
								<td>
									<div class="num-title">用户总数量</div>
									<div class="blue">{$conf.user_total}</div>
								</td>
								<td>
									<div class="num-title">会员数量</div>
									<div class="blue">{$conf.vip_num}</div>
								</td>
								<td>
									<div class="num-title">个人用户</div>
									<div class="blue">{$conf.user_num}</div>
								</td>
								<td>
									<div class="num-title">企业用户</div>
									<div class="blue">{$conf.gongsi_num}</div>
								</td>
							</tr>
						</table>
					</div>
					<div class="layui-card">
						<div class="layui-card-title">注册用户</div>
						<div class="p-3">
							<table id="UserList" lay-filter="UserList" class="layui-hide"></table>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="layui-col-md4">
			<div class="layui-card">
				<div class="layui-card-header"><h3>操作日志</h3><a data-title="操作日志" data-href="/admin/api/log_list/" class="pull-right tab-a">更多</a></div>
				<div class="layui-card-body">
					<ul class="layui-timeline" id="logs"></ul>
				</div>
			</div>
		</div>
	</div>
</div>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
	function getLogs() {
		$.ajax({
			url: "/admin/api/get_log_list",
			type: 'post',
			data: {
				page: 1,
				limit: 20
			},
			success: function (e) {
				if (e.code == 0) {
					var html = '';
					$.each(e.data, function (key, value) {
						html += '<li class="layui-timeline-item">\
										<i class="layui-icon layui-timeline-axis"></i>\
										<div class="layui-timeline-content layui-text">\
										  <div class="layui-timeline-title"><span title="'+ value.id + '">' + value.times + '</span>，' + value.content + '</div>\
										</div>\
									  </li>';
					});
					$('#logs').html(html);
				}
			}
		})
	}

	const moduleInit = ['tool'];
	function gouguInit() {
		var table = layui.table;
		$('body').on('click','[data-event="pay"]',function(){
			var src=$(this).attr('src');
			layer.open({
				type:1,
				title:'感谢您给作者加鸡腿🍗🍗',
				content:'<img src="'+src+'" style="width:100%" align=center />',
			});
		})
		getLogs();
		//注册用户
		table.render({
			elem: '#UserList'
			, url: '/admin/api/get_user_list' //数据接口
			, page: false //开启分页
			, cols: [[ //表头
				{
					field: 'avatar', title: '头像', align: 'center','width': 60, templet: function (d) {
						return '<img src="' + d.avatar + '" width="20" height="20" />';
					}
				},{ field: 'nickname', title: '昵称', align: 'center'}
				,{ field: 'mobile', title: '手机号', align: 'center'}
				, { field: 'register_time', title: '注册时间', align: 'center','width': 168}
			]]
		});

		//文章
		table.render({
			elem: '#Article'
			, url: '/admin/api/get_article_list' //数据接口
			, page: false //开启分页
			, cols: [[ //表头
				{ field: 'title', title: '标题'}
				, { field: 'explain', title: '简介', align: 'center','width': 150 }
				, { field: 'see_num', title: '浏览量', align: 'center','width': 100 }
				, { field: 'create_time', title: '发布时间', align: 'center','width': 168}
			]]
		});
		get_view_data();
	}


	function setHour(num) {
		var str = num + ':00';
		if (num < 10) {
			str = '0' + num + ':00';
		}
		return str;
	}


</script>
{/block}
<!-- /脚本 -->